/*----------------------------------------------------------------------------
 * CMSIS-RTOS 'main' function template
 *---------------------------------------------------------------------------*/
 
#include "RTE_Components.h"
#include  CMSIS_device_header
#include "cmsis_os2.h"
 
#ifdef RTE_Compiler_EventRecorder
#include "EventRecorder.h"
#endif

#include "rl_usb.h" 

/*
 * main: initialize and start the system
 */
int main (void) {
  osKernelInitialize ();                // initialize CMSIS-RTOS
 
  // initialize peripherals here
  USBD_Initialize   (0);                // USB Device 0 Initialization
  USBD_Connect      (0);                // USB Device 0 Connect
 
  // create 'thread' functions that start executing,
  // example: tid_name = osThreadCreate (osThread(name), NULL);
 
  osKernelStart ();                     // start thread execution 
  while (!USBD_Configured (0));
 
  osThreadSetPriority(osThreadGetId(), osPriorityIdle);
  for (;;);                             // Endless Loop
}
